import request from "@/helper/request";
import helper from "@/helper/helper";
// 登录接口（认证中心）
export const authLogin = (data) =>
  request({
    // url: '/auth/user/login',
    url: "/login",
    method: "post",
    data,
  });
// 请求授权码接口（认证中心）
export const getAuthCode = (params) =>
  request({
    url: "/auth/oauth/authorize",
    method: "post",
    headers: {
      token: helper.getToken(),
    },
    params,
  });
// 授权码获取token接口（认证中心生成业务系统token）/ 刷新token接口（认证中心，返回406时调用）
export const getAuthToken = (params) =>
  request({
    url: "/token",
    method: "post",
    params,
  });
// 登出接口
export const userLogout = () =>
  request({
    url: "/logout",
    method: "post",
  });
// 业务系统---获取用户详细信息
// export const getInfo = (clientId) =>
//   request({
//     url: `/getInfo/${clientId}`,
//     method: 'get'
//   })
export const getInfo = () =>
  request({
    url: `/getInfo`,
    method: "get",
  });
// 添加商品信息
export const addGoods = (data) =>
  request({
    url: "/coffeeGood/addGoods",
    method: "post",
    data,
  });
//删除商品
export const deleteInfoById = (data) =>
  request({
    url: "/coffeeGood/deleteInfoById",
    method: "get",
    params: data,
  });
// 下架商品
export const downGood = (data) =>
  request({
    url: "/coffeeGood/downGood",
    method: "get",
    params: data,
  });
// 修改商品信息
export const editGoods = (data) =>
  request({
    url: "/coffeeGood/editGoods",
    method: "post",
    data,
  });
// 根据ID查询商品信息
export const getInfoById = (data) =>
  request({
    url: "/coffeeGood/getInfoById",
    method: "get",
    data,
  });
//  查询商品列表
export const listGoods = (data) =>
  request({
    url: "/coffeeGood/listGoods",
    method: "get",
    params: data,
  });
//  查询订单列表
export const listOrders = (data) =>
  request({
    url: "/coffeeOrder/listOrders",
    method: "get",
    params: data,
  });

// 11111111
// 新增订单
export const addOrder = (data) =>
  request({
    url: "/coffeeOrder/addOrder",
    method: "post",
    data,
  });
// 完成订单
export const complateOrder = (data) =>
  request({
    url: "/coffeeOrder/complateOrder",
    method: "get",
    params: data,
  });

// 结账
export const payMoney = (data) =>
  request({
    url: "/coffeeOrder/payMoney",
    method: "get",
    params: data,
  });

// 导出订单列表
export const expertOrdersExcel = (data) =>
  request({
    url: "/coffeeOrder/expertOrdersExcel",
    method: "get",
    params: data,
    responseType: "blob",
  });

// 查询订单详情
export const statistChart = (data) =>
  request({
    url: "/coffeeOrder/statistChart",
    method: "get",
    params: data,
  });
// 查询上架的商品列表
export const findUpGoodsType = (data) =>
  request({
    url: "/coffeeOrder/findUpGoodsType",
    method: "get",
  });
// 查询订单详情
export const getOrderInfo = (data) =>
  request({
    url: "/coffeeOrder/getOrderInfo",
    method: "get",
    params: data,
  });

// 查询新增订单详情
export const getOrderFrontInfo = (data) =>
  request({
    url: "/coffeeOrder/getOrderFrontInfo",
    method: "get",
    params: data,
  });

// 删除订单
export const deletebyId = (data) =>
  request({
    url: "/coffeeOrder/deletebyId",
    method: "get",
    params: data,
  });

// 开始营业
export const doBussiness = (data) =>
  request({
    url: "/coffeeOrder/doBussiness",
    method: "get",
    params: data,
  });

// 停止营业
export const shutDown = (data) =>
  request({
    url: "/coffeeOrder/shutDown",
    method: "get",
    params: data,
  });

// 查看营业状态
export const findAppStatus = (data) =>
  request({
    url: "/coffeeOrder/findAppStatus",
    method: "get",
    params: data,
  });
